package com.yonyou.train.web;

import com.yonyou.train.ResultJson;
import com.yonyou.train.StatusCode;
import com.yonyou.train.model.Class;
import com.yonyou.train.model.Class_Student;
import com.yonyou.train.service.CourseNoticeService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpRequest;
import org.springframework.web.bind.annotation.*;


import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping(value="/coursenotice")
public class CourseNoticeController {
    @Autowired
    private CourseNoticeService courseNoticeService;

    @RequestMapping(value ="/",method = RequestMethod.GET)
    public Object doQueryCourse(HttpServletRequest request){
        List list= courseNoticeService.queryCourse(request.getHeader("token"));
        return ResultJson.success(StatusCode.SUCCESS,"success",list);
    }

    @RequestMapping(value ="/signstate",method = RequestMethod.POST)
    public Object doUpdateSignstate(@RequestBody Map<String,Map> map , HttpServletRequest request){
        courseNoticeService.updateSigndate(map.get("param"),request.getHeader("token"));
        return ResultJson.success(StatusCode.SUCCESS,"success");
    }
}
